home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr48
/
morepscl.zip
/
MORESTRG.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1993-04-05
|
2KB
|
76 lines
Uses CRT;
Function YesOrNo: Char; {waits for an answer of Y or N. Needs CRT library}
Var CH: Char;
Begin;
Repeat;
CH:=ReadKey;
CH:=UpCase(CH);
Until (CH = 'Y') or (CH = 'N');
YesOrNo:=CH;
End;
Function Yes: Boolean; {boolean version of YesOrNo. Needs CRT library}
Var CH: Char;
Begin;
Repeat;
CH:=ReadKey;
CH:=UpCase(CH);
Until (CH='Y') or (CH='N');
Yes:=(CH='Y');
End;
Function NumInStr(S: String): Boolean;
{checks a string to see if it contains ONLY a numeric value}
VAR
C, I: INTEGER;
N: BOOLEAN;
BEGIN;
I:=0;
Repeat;
I:=I+1;
C:=Ord(S[I]);
N:=( (C >= 48) AND (C <= 57) );
Until (NOT N) OR (I=Length(S));
NumInStr:=N;
END; {Number In String}
Function SubStr(S: String; X, Y: Integer): String;
{ syntax: A:=SUBSTR(S,X,Y)
operates similarly to the COPY function, but 'Y' represents the
endpoint, not the length of the substring. This is the method that
FORTRAN and BASIC use for calling substrings.
ex.: Writeln(COPY('COMPUTER',2,5));
output: OMPUT
Writeln(SUBSTR('COMPUTER',2,5));
output: OMPU
}
Begin;
SubStr:=Copy(S,X,((Y-X)+1));
End;
Procedure StrSwap(Var A, B: String);
Var C: String;
Begin;
C:=A;
A:=B;
B:=C;
End;
Function Left(X: STRING; Y: INTEGER): STRING;
{This is the equivalent of BASIC's LEFT$ function}
BEGIN;
Left:=Copy(X,1,Y);
END; {Left}
Function Right(X: STRING; Y: INTEGER): STRING;
{This is the equivalent of BASIC's RIGHT$ function}
VAR L: INTEGER;
BEGIN;
L:=Length(X)-Y;
Right:=Copy(X,L+1,Y);
END; {Right}